package com.example.controller;

import com.example.entity.TOrder;

import com.example.service.ITOrderService;
import com.hzit.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.net.URI;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lmy
 * @since 2025-01-14
 */
@RestController
@RequestMapping("/tOrder")
public class TOrderController {
    @Autowired
    private ITOrderService itOrderService;
    @Resource
    private LoadBalancerClient client;

    //查询商品列表
    @GetMapping("/list")
    public R<List<TOrder>> list(){
        URI uri = client.choose("order").getUri();
        return R.ok(itOrderService.list());
    }
}
